<template>
  <div class="diyVideoControl">
    <div class="control-section">
      <div class="control-header">
        <span>魔方导航</span>
        <span @click.stop="showBeautyBox = true" style="cursor: pointer"
          >组件美化</span
        >
      </div>
      <div class="control-body">
        <div class="control-item">
          <div class="control-title flex-between">
            <span>导航列数</span>
            <span class="reset" @click="resetItem('columnNumber')">重置</span>
          </div>
          <div class="control-content">
            <a-select
              :value="params.params.columnNumber"
              @change="
                (e) => {
                  setwithActionItem(e, 'columnNumber');
                }
              "
              class="dotsPosition-select"
            >
              <a-select-option value="3"> 三列 </a-select-option>
              <a-select-option value="4"> 四列 </a-select-option>
              <a-select-option value="5"> 五列 </a-select-option>
            </a-select>
          </div>
        </div>
        <div class="control-item">
          <div class="control-title flex-between">
            <span>导航行数</span>
            <span class="reset" @click="resetItem('numberOfLines')">重置</span>
          </div>
          <div class="control-content">
            <a-select
              :value="params.params.numberOfLines"
              @change="
                (e) => {
                  setwithActionItem(e, 'numberOfLines');
                }
              "
              class="dotsPosition-select"
            >
              <a-select-option value="1"> 一行 </a-select-option>
              <a-select-option value="2"> 二行 </a-select-option>
            </a-select>
          </div>
        </div>
        <div class="control-item">
          <div class="control-title flex-between">
            <span>滑动效果</span>
            <span class="reset" @click="resetItem('drain')">重置</span>
          </div>
          <div class="control-content">
            <a-select
              :value="params.params.drain"
              @change="
                (e) => {
                  setwithActionItem(e, 'drain');
                }
              "
              class="dotsPosition-select"
            >
              <a-select-option value="1"> 整行滑动 </a-select-option>
              <a-select-option value="2"> 单列滑动 </a-select-option>
              <a-select-option value="3"> 固定显示 </a-select-option>
            </a-select>
          </div>
        </div>
      </div>
    </div>
    <!-- 组件美化 -->
    <comBeautyBox
      :showBeautyBox="showBeautyBox"
      @handleBack="showBeautyBox = false"
    >
      <div>
        <bgControl :backgroudData="params.moduleCss" sizeText="750*330"></bgControl>
        <!-- 间距圆角控制 -->
        <spaceControl
          :spaceData.sync="params.moduleCss"
          @resetSpace="resetSpace"
          @resetMp="resetMp"
        ></spaceControl>
      </div>
    </comBeautyBox>
  </div>
</template>


<script>
import comBeautyBox from "@/components/DiyNew/diy/comBeautyBox/comBeautyBox.vue";
import bgControl from "@/components/DiyNew/diy/baseControl/bgControl/index.vue";
import uploadImg from "@/components/DiyNew/uploadImg/index.vue";
import uploadVideo from "@/components/DiyNew/uploadVideo/index.vue";
import spaceControl from "@/components/DiyNew/diy/baseControl/spaceControl/index.vue";
export default {
  name: "cubeNavControl",
  components: {
    comBeautyBox,
    bgControl,
    uploadImg,
    uploadVideo,
    spaceControl,
  },
  props: {
    params: {
      type: Object,
      default: {},
    },
  },
  data() {
    return {
      choosedTab: {},
      showBeautyBox: false,
    };
  },
  methods: {
    uploadSuccess(e) {
      console.log(e);
      this.$setWithAction(this.params.params, "picUrl", e.val);
      // this.params.params.picUrl = e.val
    },
    uploadVideoSuccess(e) {
      this.$setWithAction(this.params.params, "videoUrl", e.val);
      // this.params.params.videoUrl = e.val
    },
    // 重置圆角
    resetSpace(e) {
      let type = e.type;
      this.$set(this.params.moduleCss, type, 0);
    },
    // 重置边距
    resetMp() {
      this.$set(this.params.moduleCss, "margin", 0);
      this.$set(this.params.moduleCss, "padding", 0);
    },
    resetItem(e) {
        console.log(e);
        if(e == 'columnNumber') {
            this.$set(this.params.params,e,'3')
        }
        if(e == 'numberOfLines') {
            this.$set(this.params.params,e,'1')
        }
        if(e == 'drain') {
            this.$set(this.params.params,e,'1')
        }
    },
    setwithActionItem(e,type) {
        this.$setWithAction(this.params.params, type, e);
    }
  },
};
</script>


<style lang="scss" scoped>
.control-section {
  width: 100%;
  margin: 0 auto;
  text-align: center;
  .control-header {
    width: 100%;
    height: 48px;
    background: #ffffff;
    border-bottom: 1px solid #f0f2f5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    span:first-child {
      font-weight: 600;
      color: #000000;
    }
    span:last-child {
      font-size: 12px;
      color: #8c8c8c;
    }
  }
  .control-body {
    width: 228px;
    margin: 0 auto;
    .control-item {
      width: 100%;
      .control-title {
        padding: 24px 0 14px 0;
        font-size: 12px;
        color: #000000;
        text-align: left;
      }
      .flex-between {
        display: flex;
        justify-content: space-between;
        align-items: center;
      }
      .reset {
        font-size: 12px;
        color: #9e9e9e;
        cursor: pointer;
      }
      .control-content {
        .dotsPosition-select {
          width: 100%;
          height: 100%;
          ::v-deep .ant-select-selection--single {
            height: 100%;
            border: 0 none;
            background: #f2f2f2;
          }
          ::v-deep .ant-select-selection__rendered {
            line-height: 40px;
          }
        }
        .example-list {
          width: 100%;
          display: flex;
          flex-wrap: wrap;
          .example-item {
            width: 70px;
            height: 38px;
            background: #f6f7f9;
            border-radius: 4px;
            margin-right: 9px;
            display: flex;
            justify-content: center;
            align-items: center;
            cursor: pointer;
            img {
              width: 42px;
              height: 18px;
            }
          }
          .example-item:last-child {
            margin-right: 0;
          }
          .active {
            border: 2px solid #1890fc;
          }
        }
      }
    }
  }
}
.control-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 0 12px 0;
  font-size: 12px;
  font-weight: 400;
  color: #000000;
  .reset {
    font-size: 12px;
    font-weight: 400;
    color: #8e8e8e;
    cursor: pointer;
    user-select: none;
  }
  p {
    margin: 0;
  }
}
.moduleName {
  display: flex;
  align-items: center;
  justify-content: space-between;
  .nameText {
    width: 196px;
    height: 40px;
    background-color: #f6f7f9;
    border-radius: 4px;
    padding: 0 14px;
    input {
      width: 100%;
      height: 100%;
      border: none;
      outline: none;
      background-color: #f6f7f9;
    }
  }
  .show {
    width: 24px;
    height: 24px;
    background-color: #f6f7f9;
    border-radius: 4px;
    cursor: pointer;
    color: #000000;
  }
}
</style>